#include<iostream>
using namespace std;
int main()
{
	int n;
	while (cin >> n)
	{
		int count = 0;
		while (n)
		{
			count++;
			n &= (n - 1);
		}
		cout << count << endl;
	}
	return 0;	
}